package gunfire.relics;

import basemod.abstracts.CustomRelic;
import com.badlogic.gdx.graphics.Texture;
import com.megacrit.cardcrawl.actions.common.ReducePowerAction;
import com.megacrit.cardcrawl.actions.common.RelicAboveCreatureAction;
import com.megacrit.cardcrawl.actions.common.RemoveSpecificPowerAction;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.relics.AbstractRelic;
import gunfire.GunfireMod;
import gunfire.util.TextureLoader;

import static gunfire.GunfireMod.makeRelicOutlinePath;
import static gunfire.GunfireMod.makeRelicPath;

public class PreemptiveStrike extends CustomRelic {

    public static final String ID = GunfireMod.makeID("PreemptiveStrike");
    private static final Texture IMG = TextureLoader.getTexture(makeRelicPath("PreemptiveStrike.png"));
    private static final Texture OUTLINE = TextureLoader.getTexture(makeRelicOutlinePath("blank.png"));

    public PreemptiveStrike() {
        super(ID, IMG, OUTLINE, RelicTier.COMMON, LandingSound.CLINK);
    }

    @Override
    public void atBattleStart() {
        this.flash();
        for (AbstractMonster m : AbstractDungeon.getMonsters().monsters){
            if (!m.isDead && !m.isDying && m.hasPower("Artifact")) {
                this.addToBot(new RelicAboveCreatureAction(m, this));
                this.addToBot(new RemoveSpecificPowerAction(m, m, "Artifact"));
            }
        }
    }

    @Override
    public String getUpdatedDescription() {
        return DESCRIPTIONS[0];
    }

    @Override
    public AbstractRelic makeCopy() {
        return new PreemptiveStrike();
    }
}
